package com.javalsj.common.webflux.autoconfigure;

import java.nio.charset.Charset;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter;

/**
 * @description 公共WEBFLUX配置类
 * @author WANGJIHONG
 * @date 2019年5月28日 下午12:55:11 
 * @Copyright 版权所有 (c) www.jiuqi.com
 * @memo 无备注说明
 */
@Configuration
@ComponentScan({"com.javalsj.common.webflux"})
public class CommonWebFluxAutoConfiguration {
	
	@Bean
	@ConditionalOnMissingBean(StringHttpMessageConverter.class)
	public StringHttpMessageConverter responseBodyConverter() {
		StringHttpMessageConverter converter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
		return converter;
	}
	
	 @Bean
	 @Order(Integer.MIN_VALUE)
    public WebSocketHandlerAdapter handlerAdapter() {
        return new WebSocketHandlerAdapter();
    }
	
}
